package com.hdoit.ares.web.ser.modelconfig;
import com.hdoit.ares.web.ser.providers.GoodsCurrencyStateProvider;
import com.hdoit.ares.web.ser.providers.StaffStoreProvider;
import com.tennetcn.common.enums.regular.MathRegularExpressions;
import com.tennetcn.common.enums.regular.RegularExpressions;
import com.tennetcn.component.attribute.DisplayNameAttribute;
import com.tennetcn.component.attribute.DropDownListAttribute;
import com.tennetcn.component.attribute.RegularExpressionAttribute;
import com.tennetcn.component.attribute.RequiredAttribute;
import com.tennetcn.component.attribute.base.ModelMetadataAttributeConfiguration;

/**
 * @author      lvsi
 * @email       
 * @createtime  2017年11月22日 19:31:32
 * @comment
 */
public class GoodsServiceConfig extends ModelMetadataAttributeConfiguration{
    public GoodsServiceConfig(){
        this.setProperty("serviceTypeName")
            .hasAttribute(new DisplayNameAttribute("服务类型"))
            .hasAttribute(new RequiredAttribute("服务类型为必填项"))
        .hasAttribute(new DropDownListAttribute());

        this.setProperty("serviceName")
            .hasAttribute(new DisplayNameAttribute("服务名称"))
            .hasAttribute(new RequiredAttribute("服务名称为必填项"))
        .hasAttribute(new DropDownListAttribute());

        this.setProperty("serviceGoodsName")
            .hasAttribute(new DisplayNameAttribute("商品名称"))
        .hasAttribute(new RequiredAttribute("商品为必填项"));

        this.setProperty("goodsSortCode")
            .hasAttribute(new DisplayNameAttribute("商品排序"))
            .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));

        this.setProperty("serviceGoodsDescription")
            .hasAttribute(new DisplayNameAttribute("商品描述"));

        this.setProperty("serviceGoodsNum")
            .hasAttribute(new DisplayNameAttribute("商品数量"))
            .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));

        this.setProperty("goodsOriginalPrice")
            .hasAttribute(new DisplayNameAttribute("销售价格"));
     /*  .hasAttribute(new RegularExpressionAttribute("^((\\d{1,9}.\\d{1,2})|(\\d{1,9}))$"));*/

        this.setProperty("goodsMaketPrice")
            .hasAttribute(new DisplayNameAttribute("活动价格"));
      /*  .hasAttribute(new RegularExpressionAttribute("^((\\d{1,9}.\\d{1,2})|(\\d{1,9}))$"));*/

        this.setProperty("goodsOriginalCurrency")
            .hasAttribute(new DisplayNameAttribute("销售价格币种"))
            .hasAttribute(new DropDownListAttribute(new GoodsCurrencyStateProvider()));

        this.setProperty("goodsMaketCurrency")
            .hasAttribute(new DisplayNameAttribute("活动价格币种"))
            .hasAttribute(new DropDownListAttribute(new GoodsCurrencyStateProvider()));

        this.setProperty("goodsContent")
            .hasAttribute(new DisplayNameAttribute("商品内容"));

        this.setProperty("thumbnailId")
            .hasAttribute(new DisplayNameAttribute("缩略图"));

        this.setProperty("largeMapId")
            .hasAttribute(new DisplayNameAttribute("大图"));

        this.setProperty("createName")
            .hasAttribute(new DisplayNameAttribute("创建人"));

        this.setProperty("modifyName")
            .hasAttribute(new DisplayNameAttribute("修改人"));

        this.setProperty("code")
            .hasAttribute(new DisplayNameAttribute("全拼"));

        this.setProperty("markCode")
            .hasAttribute(new DisplayNameAttribute("首字母连读"));
        
        this.setProperty("goodStoreId")
        .hasAttribute(new DisplayNameAttribute("店铺名称"))
       .hasAttribute(new DropDownListAttribute(new StaffStoreProvider(), false));

        this.setProperty("serviceAddress")
        .hasAttribute(new DisplayNameAttribute("销售地区"))
        .hasAttribute(new RequiredAttribute("销售地区为必填项"));
        
        this.setProperty("serviceProvince")
        .hasAttribute(new DisplayNameAttribute("省"))
        .hasAttribute(new DropDownListAttribute());

        this.setProperty("serviceCity")
        .hasAttribute(new DisplayNameAttribute("市"))
        .hasAttribute(new DropDownListAttribute());

        this.setProperty("serviceCounty")
        .hasAttribute(new DisplayNameAttribute("区"))
        .hasAttribute(new DropDownListAttribute());
        
        this.setProperty("goodStore.storePhone")
        .hasAttribute(new DisplayNameAttribute("联系电话"))
        .hasAttribute(new RegularExpressionAttribute(RegularExpressions.mobile));

        this.setProperty("goodStore.storeManagerName")
        .hasAttribute(new DisplayNameAttribute("店铺负责人"));

    }
}
